Skip to content

fix(web): keep citation markers users type in their own messages - #39657

Open
LetterXbox wants to merge 1 commit into
pingdotgg:fix/issue-30979from
LetterXbox:fix/citation-user-message-scope
Open

LetterXbox wants to merge 1 commit into
pingdotgg:fix/issue-30979from
LetterXbox:fix/citation-user-message-scope

Conversation

@LetterXbox

Copy link
Copy Markdown

Part of #30979. Stacked on #31053, so it targets fix/issue-30979. It addresses the remaining review finding on #31053: citation stripping should apply only to assistant output, and markers in user messages should be preserved.

Problem

#31053 hides web citation markers (U+E200 cite U+E202 turn0search0 U+E201) with a remark transform that runs on every ChatMarkdown render. User prompts render through the same pipeline. So a marker the user typed disappears from their sent message and from thread find, even though the raw text went to the agent unchanged.

Fix

remarkCodexDirectives takes a keepWebCitations option. A new CHAT_USER_MARKDOWN_REMARK_PLUGINS list reconfigures the plugin for user-authored text:

  • sent user messages (UserMessageBody; side chat uses the same row)
  • review-comment text in a sent message and in the composer preview
  • the user processor in thread find

Assistant output, agent questions, plans and reasoning still hide markers.

The option restores the marked text and URL fields around the existing walk instead of threading a flag through it. That leaves the walker exactly as #33049 rewrites it. Once #33049 lands, the gate can move into the walker.

No changes were needed for:

  • Mobile. User messages render from raw text and return before the assistant-only directive helpers.
  • Copy. User copy buttons copy raw text, and selection copy reads the rendered DOM.

Verification

  • Two regression cases, one in codexMarkdownDirectives.test.ts and one in threadFindText.test.ts. Both fail on 7c74436: the marker is stripped from a user message ("Explain \uE200cite\uE202turn0search0\uE201 please" → "Explain please") and from text, labels and link destinations. Both pass with the fix. The threadFindText, codexMarkdownDirectives and markdownPipeline suites pass 68/68.
  • vp run check:changed origin/fix/issue-30979: format, lint, knip, typecheck (35 packages), tests and the React compiler check all pass.
  • Stacking: git merge-tree is clean against fix(shared): keep words separated when hiding citations #33049 (f7201b0) and fix(shared): hide a web citation marker that is still streaming #34864's own commit (cc8ae86).
  • Real client: a dev server on this branch with the Replay provider. I sent Please explain this literal marker: \uE200cite\uE202turn0search0\uE201 in my message. from the composer. On 7c74436 the sent bubble reads Please explain this literal marker: in my message. With this branch it shows the marker as typed (the private-use characters render as font fallback glyphs).
Before (7c74436) After
Before: the marker is missing from the sent message After: the marker shows as typed

Not covered:

Implemented with Claude Code (Opus 5.5) and reviewed with Codex (GPT-6.2 Astra).

🤖 Generated with Claude Code

User prompts render through the same Markdown pipeline as assistant output,
so a web citation marker a user typed vanished from the conversation and
from thread find while the raw text still went to the agent.

remarkCodexDirectives takes a keepWebCitations option, and the new
CHAT_USER_MARKDOWN_REMARK_PLUGINS list reconfigures it for user-authored
text: sent messages, review comment text, and the user find processor.
Assistant output still hides the markers. The option restores the marked
fields around the existing walk rather than threading a flag through it,
so the walker stays as the stacked citation fixes leave it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant